package com.activepad.module.customer.action;

import com.activepad.common.action.SurveyAction;
import com.activepad.module.customer.pojo.AccountVo;
import com.activepad.module.customer.pojo.CustomerVo;
import com.activepad.module.customer.service.EnterpriseAccountService;

/**
 * 企业用户的账户管理请求Action
 * 
 * 
 * @author 孙树林
 * 
 */
public class EnterpriseAccountAction extends SurveyAction {

	private static final long serialVersionUID = 8907487052257645478L;

	private EnterpriseAccountService enterpriseAccountService;
	
	private AccountVo accountVo = new AccountVo();
	
	private CustomerVo customerVo = new CustomerVo();

	/**
	 * 查找企业客户某一账户资料请求处理方法
	 * 
	 * @return
	 */
	public String findEnterpriseAccount() {
		Integer id = accountVo.getId();
		Integer custId = accountVo.getCustId();
		if(id != null) {
			accountVo = enterpriseAccountService.findEnterpriseAccount(id);
		}
		accountVo.setCustId(custId);
		return SUCCESS;
	}
	
	/**
	 * 编辑企业用户的账户资料
	 * @return
	 */
	public String editEnterpriseAccount() {
		enterpriseAccountService.editEnterpriseAccount(accountVo);
		customerVo.setId(accountVo.getCustId());
		return SUCCESS;
	}
	
	/**
	 * 删除企业用户账户资料
	 * @return
	 */
	public String deleteEnterpriseAccount() {
		enterpriseAccountService.deleteEnterpriseAccount(accountVo.getId());
		return SUCCESS;
	}

	public AccountVo getAccountVo() {
		return accountVo;
	}

	public void setAccountVo(AccountVo accountVo) {
		this.accountVo = accountVo;
	}

	public void setEnterpriseAccountService(EnterpriseAccountService enterpriseAccountService) {
		this.enterpriseAccountService = enterpriseAccountService;
	}

	public CustomerVo getCustomerVo() {
		return customerVo;
	}

	public void setCustomerVo(CustomerVo customerVo) {
		this.customerVo = customerVo;
	}
}
